import Vue from 'vue';
import Vuex from 'vuex';
import * as actions from './actions';
import * as getters from './getters';
import state from './states';
import mutations from './mutations';
import createLogger from 'vuex/dist/logger'; // vuex 打印日志

Vue.use(Vuex);

const debug = process.env.NODE_ENV !== 'production';

export default new Vuex.Store({
  state,
  actions,
  mutations,
  getters,
  strict: debug, // 开发环境下，启动vuex的严格模式，打印mutations修改日志
  plugins: debug ? [createLogger()] : [], // 开发环境下，提供createLogger插件
});
